package com.edu.mapper;

import com.edu.bean.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author:mx
 * @Date:2025/9/26-11:32:39
 */
public interface StudentMapper {

    @Select("SELECT * FROM student WHERE stuId = #{stuId}")
    Student selectStudentById(int stuId);


    @Select("SELECT * FROM student")
    List<Student> selectAllStudent();

    @Delete("DELETE FROM student WHERE stuId = #{stuId}")
    int deleteStudent(int stuId);

    @Insert("INSERT INTO student(stuName,stuSex,stuAge) VALUES (#{stuName},#{stuSex},#{stuAge})")
    int insertStudent(Student stu);

    @Update("UPDATE student set stuName = #{stuName},stuAge = #{stuAge},stuSex = #{stuSex} WHERE stuId = #{stuId}")
    int updateStudent(Student stu);



}
